/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aplikasirawatinap;

import javax.swing.JOptionPane;

/**
 *
 * @author Saptaji
 */
public class UserForm extends javax.swing.JFrame {

    /**
     * Creates new form User
     */
    private int ok;
    public UserForm() {
        setTitle("FORM USER");
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lb_background = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        m_logout = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        m_pendaftaran = new javax.swing.JMenuItem();
        m_pembayaran = new javax.swing.JMenuItem();
        m_cari_pas = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        m_mawar = new javax.swing.JMenuItem();
        m_melati = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        lb_background.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/image1.jpg"))); // NOI18N

        jMenu1.setText("File");

        jMenuItem1.setText("About Aplikasi");
        jMenu1.add(jMenuItem1);

        m_logout.setText("Log Out");
        m_logout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_logoutActionPerformed(evt);
            }
        });
        jMenu1.add(m_logout);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Menu");

        m_pendaftaran.setText("Pendaftaran");
        m_pendaftaran.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_pendaftaranActionPerformed(evt);
            }
        });
        jMenu2.add(m_pendaftaran);

        m_pembayaran.setText("Pembayaran");
        m_pembayaran.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_pembayaranActionPerformed(evt);
            }
        });
        jMenu2.add(m_pembayaran);

        m_cari_pas.setText("Cari Pasien");
        m_cari_pas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_cari_pasActionPerformed(evt);
            }
        });
        jMenu2.add(m_cari_pas);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Daftar Kamar");

        m_mawar.setText("Ruang Mawar");
        m_mawar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_mawarActionPerformed(evt);
            }
        });
        jMenu3.add(m_mawar);

        m_melati.setText("Ruang Melati");
        m_melati.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_melatiActionPerformed(evt);
            }
        });
        jMenu3.add(m_melati);

        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lb_background)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lb_background, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    private void m_pendaftaranActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_pendaftaranActionPerformed
        PendaftaranForm pen = new PendaftaranForm();
        pen.setLocationRelativeTo(this);
        pen.setVisible(true);
        dispose();
    }//GEN-LAST:event_m_pendaftaranActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        // TODO add your handling code here:
        ok = JOptionPane.showConfirmDialog(null, "Anda yakin ingin keluar dari aplikasi?", "Konfirmasi", JOptionPane.OK_CANCEL_OPTION);
        if (ok == 0){
            System.exit(0);
        }
    }//GEN-LAST:event_formWindowClosing

    private void m_pembayaranActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_pembayaranActionPerformed
        // TODO add your handling code here:
        new PembayaranForm().setVisible(true);
        dispose();
    }//GEN-LAST:event_m_pembayaranActionPerformed

    private void m_logoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_logoutActionPerformed
        // TODO add your handling code here:
        Login l = new Login();
        l.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_m_logoutActionPerformed

    private void m_mawarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_mawarActionPerformed
        // TODO add your handling code here:
        new RuangMawar().setVisible(true);
        dispose();
    }//GEN-LAST:event_m_mawarActionPerformed

    private void m_melatiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_melatiActionPerformed
        // TODO add your handling code here:
        new RuangMelati().setVisible(true);
        dispose();
    }//GEN-LAST:event_m_melatiActionPerformed

    private void m_cari_pasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_cari_pasActionPerformed
        // TODO add your handling code here:
        new DataPasien().setVisible(true);
        dispose();
    }//GEN-LAST:event_m_cari_pasActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(UserForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(UserForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(UserForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(UserForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new UserForm().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JLabel lb_background;
    private javax.swing.JMenuItem m_cari_pas;
    private javax.swing.JMenuItem m_logout;
    private javax.swing.JMenuItem m_mawar;
    private javax.swing.JMenuItem m_melati;
    private javax.swing.JMenuItem m_pembayaran;
    private javax.swing.JMenuItem m_pendaftaran;
    // End of variables declaration//GEN-END:variables
}
